package com.example.zhc36.fragment;


import android.support.v4.widget.DrawerLayout;

import android.view.View;
import android.widget.TextView;

import com.example.zhc36.fragment.frag.MainMainFragment;
import com.example.zhc36.fragment.utils.app.BaseActivity;


public class MainActivity extends BaseActivity {
    private DrawerLayout dl;
    private TextView tv;
    private MainMainFragment fm;
    private int with = 600;

    @Override
    protected int getLayoutId() {

        return R.layout.act_main;
    }

    @Override
    protected void initView() {
        dl = findViewById(R.id.dl);
        tv = findViewById(R.id.tv);
        fm = (MainMainFragment) getSupportFragmentManager().findFragmentById(R.id.fm);


    }

    @Override
    protected void initData() {
        dl.addDrawerListener(new DrawerLayout.SimpleDrawerListener() {
            @Override
            public void onDrawerSlide(View drawerView, float slideOffset) {
                super.onDrawerSlide(drawerView, slideOffset);
                fm.getView().setTranslationX(600 * slideOffset);//滑动从0-1
                tv.setTranslationX(600 / 2 - 600 / 2 * slideOffset);


            }
        });

    }

    @Override
    protected void initListener() {

    }

}
